package com.sgb.kjwl.view.widget.transport;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.IntRange;
import androidx.annotation.NonNull;

import com.sgb.kjwl.R;
import com.sgb.kjwl.view.widget.MapQuotePopWindow;

import org.jetbrains.annotations.NotNull;

/**
 * Describe:    报价单位-地图页面展示——图标说明弹窗
 * Author:  yangLei
 * Date:    2021/8/27
 */
public class IconExplainDialog extends Dialog {
    //0——其他视角页面(竞价货源)  1——货主视角页面(竞价货源)  2——普通货源
    private int type;
    private Context context;
    private TextView seeBtn;

    private IconExplainDialog(Context context, int windowType) {
        super(context, R.style.app_transparent_dialog);
        this.type = windowType;
        this.context = context;
    }

    public static IconExplainDialog newInstance(Context context, @IntRange(from = 0, to = 2) int windowType) {
        return new IconExplainDialog(context, windowType);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        switch (type) {
            case 0:
                setContentView(R.layout.app_icon_explain_01_layout);
                break;
            case 1:
                setContentView(R.layout.app_icon_explain_02_layout);
                break;
            case 2:
                setContentView(R.layout.app_icon_explain_03_layout);
                break;
        }

        seeBtn = findViewById(R.id.i_see_btn);
        seeBtn.setOnClickListener(v -> dismiss());

//        int width = context.getResources().getDisplayMetrics().widthPixels;
//        getWindow().setLayout(width / 10 * 7, LinearLayout.LayoutParams.WRAP_CONTENT);
        setCanceledOnTouchOutside(true);
    }
}
